namespace ThaiThoa.Win.QLSX.DAL.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class _4 : DbMigration
    {
        public override void Up()
        {
            RenameTable(name: "dbo.DonDatHangs", newName: "DonDatHang");
            RenameTable(name: "dbo.DonDatHangChiTiets", newName: "DonDatHangChiTiet");
            CreateTable(
                "dbo.CongCuDungCu",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        MoTa = c.String(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.MatHang", t => t.Id)
                .Index(t => t.Id);
            
            AddColumn("dbo.MatHang", "SoLuong", c => c.Double(nullable: false));
            AddColumn("dbo.MayMoc", "DayChuyen_Id", c => c.Guid());
            AddForeignKey("dbo.MayMoc", "DayChuyen_Id", "dbo.DayChuyen", "Id");
            CreateIndex("dbo.MayMoc", "DayChuyen_Id");
        }
        
        public override void Down()
        {
            DropIndex("dbo.MayMoc", new[] { "DayChuyen_Id" });
            DropIndex("dbo.CongCuDungCu", new[] { "Id" });
            DropForeignKey("dbo.MayMoc", "DayChuyen_Id", "dbo.DayChuyen");
            DropForeignKey("dbo.CongCuDungCu", "Id", "dbo.MatHang");
            DropColumn("dbo.MayMoc", "DayChuyen_Id");
            DropColumn("dbo.MatHang", "SoLuong");
            DropTable("dbo.CongCuDungCu");
            RenameTable(name: "dbo.DonDatHangChiTiet", newName: "DonDatHangChiTiets");
            RenameTable(name: "dbo.DonDatHang", newName: "DonDatHangs");
        }
    }
}
